<template>
 <view class="main">
   <view class="logo">
	 <view class="ilist" @click="myitem">
		<view class="ilist1"></view> 
		<view class="ilist2"></view> 
	 </view>
	 我的优选拍手   
   </view>

   <view class="main1"> 
	   <view class="part2">
		 <view class="item1" v-for="(item,index) in favlist">
		   <view class="item1-1" @click="gorder(item.pinfo.uid)">
			 <view class="itxt2" v-if="item.pinfo.level<=1">【实习拍手】</view>
			 <view class="itxt2" v-if="item.pinfo.level==2">【普通拍手】</view>
			 <view class="itxt2" v-if="item.pinfo.level==3">【达人拍手】</view>
			 <view class="itxt1"></view>
			<view class="itxt8">{{item.pinfo.xm}}</view>
			<image :src="item.puser.avatar" class="img1"></image>
		   </view>
		   <view class="item1-2">
			 <view class="itxt3" @click="gorder(item.pinfo.uid)">
			   <view class="itxt3-1">
				 <image src="https://ppp.new.zeroitem.cn/ppp/tip2.png" class="img3"></image> 
				  <view class="it3-1">
					<view>{{item.pinfo.psinfo.address}}</view>  
				  </view>
			   </view> 
			   <view class="itxt3-2">
			     <image src="https://ppp.new.zeroitem.cn/ppp/sm2.png" class="img3"></image> 
				  <view class="it3-1">
					{{item.pinfo.pxinfo.desc}}
				  </view>				   
			   </view> 
			 </view>

		   </view>
		   <view class="item1-3" @click="gorder(item.pinfo.uid)">
			   <view class="itxt5 ibg">拍手详情</view>
		   </view>
		 </view> 
	   </view>	      
   </view>
   
   
   
  </view>
</template>

<script>
	import {
		mapGetters,
		mapActions
	} from 'vuex'
	import {
		toLogin
	} from '@/utils/login'
	
	import {
		loadingFun,
		menuJump
	} from '@/utils/tools'	
	
    import {
		loadingType
	} from '@/utils/type'
	
    import {
	   yxfavlist
	} from '@/api/ppp'	
  const app = getApp()		
  export default {
	    data() {
	        return {
			 favlist:[],
			 video:null,
			 page: 1,
			 status: loadingType.LOADING
	        }
	    },
		onShow(){

		},
		onLoad(){
		 this.getfav(); 
		 //this.total_order();	 
		},
		onReachBottom() {
		 this.getfav();
		 setTimeout(() => {
		 	uni.stopPullDownRefresh();
		 }, 1000);	
		},
	    methods: {
		showplay(index){
			  var that=this;
			  var orderlist=that.orderlist;
			  if(orderlist[index].has_video==0){
				uni.showToast({title:'当前没有视频',icon:'none'});
			    return false;	  
			  }
			  orderlist[index].play=1;
			  orderlist[index].src1=orderlist[index].video_src;
			  that.orderlist=orderlist;
			  that.videoPlayHandle('id'+orderlist[index].id); 
			},
		    videoPlayHandle(id) {
			let newVideo = uni.createVideoContext(id);
			newVideo.id = id;
			if (!this.video) {
				this.video = newVideo;
				this.video.play();
				return
			}
			if (this.video.id !== newVideo.id) {
				newVideo.play();
				this.video.pause();
				this.video = newVideo;
			}
		},
		gorder(zt){
		 uni.navigateTo({
		 	url:"/pages/ppp/ps/main?pid="+zt
		 })	
		},	
	    async getfav(){
			 //const data = await loadingFun(pslist,this.page,this.plist,this.status,{});
			 const data = await loadingFun(yxfavlist,this.page,this.favlist,this.status,{});
			if (!data) return
			this.page = data.page
			this.favlist = data.dataList
			this.status = data.status	  
		},
		jumpmenu(kn){
		if(kn==1){
		  uni.redirectTo({
			 url:"/pages/ppp/index/order"
		  })
		 }	
		 if(kn==2){
		   uni.redirectTo({
		 	 url:"/pages/ppp/index/drps"
		   })
		  }	
		 if(kn==3){
		   uni.redirectTo({
		 	 url:"/pages/ppp/index/dzxx"
		   })
		  }	
		 if(kn==4){
		   uni.redirectTo({
		 	 url:"/pages/ppp/index/dqdd"
		   })
		  }					
		  
		},
	    },
	   computed: {
	  	...mapGetters(['isLogin']),
	   }	
		
	}	
</script>

<style>
@import "./wdyx.css";	
</style>
